<template>
    <div class="pages">
      <div class="moneyBox">
        <div class="weui-cells weui-cells_form" style="margin-bottom: 20rpx;">
          <div class="weui-cell">
            <div class="weui-cell__hd"><label class="weui-label">提现金额</label></div>
            <div class="weui-cell__bd money">
              <p>￥</p>
              <input id="js_input" class="weui-input" v-model.lazy="moneyInput" placeholder="请输入金额">
            </div>
          </div>


        </div>
        <div class="weui-form__tips-area" style="margin:58rpx 0">
          <p class="weui-form__tips" style="color: #ddd">
           可提现余额{{money}}元，
            <span style="color: #666">全部提现</span>
          </p>
        </div>
        <div class="weui-form__opr-area">
          <a class="weui-btn weui-btn_primary weui-btn_disabled"  id="showTooltips" @click="pay">确定</a>
        </div>
      </div>
    </div>
</template>

<script>
    export default {
        name: "index",
        data(){
            return {
                money:0,
              moneyInput:""
            }
        },
        onLoad(options){
          this.money=options.money;
        },
      onShow(){
        wx.setNavigationBarTitle({
          title: '提现'
        })
      },
        methods:{
            pay(){
              let openId=wx.getStorageSync('openId')
              let userId =  wx.getStorageSync('userId')
                this.$http.request({
                    method: 'post',
                    url: `/api/pay/entPay`,
                    body: {
                      description:"提现",
                      openid:openId,
                      amount:this.moneyInput,
                      userId:userId
                    }
                }).then((data) => {
                    if (data.code == 200) {

                    } else {
                        wx.showToast({
                            title: `${data.message}`,
                            icon: 'none',
                            duration: 2000
                        })
                    }
                }).catch((err) => {
                    this.isCart = false
                })
            }
        }
    }
</script>

<style scoped>
  .moneyBox>div{
    margin-bottom: 20rpx;
  }
  .pages{
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    padding:0 5%;
    background-color: #fff;
  }
  .pages .weui-cells{
    margin-top:0;
  }
  .money{
    display: flex;
    justify-content: flex-start;
  }
</style>
